﻿using System.Collections;
using System.Collections.Generic;
using UniFramework.Battle;
using UniFramework.Buff;
using UnityEngine;
using UnityEngine.Serialization;

namespace UniFramework.Actor
{
	public partial class LogicActor : LogicObject
	{
		public bool isDead = false;
		private BuffSystem _buffSystem;
		public LogicActorState actorState;

		public override void OnCreate()
		{
			base.OnCreate();
			_buffSystem = gameObject.AddComponent<BuffSystem>();
			_buffSystem.OnInit(this);
			actorState = gameObject.AddComponent<LogicActorState>();
		}

		public override void OnLogicFrameUpdate(int curFrame)
		{
			base.OnLogicFrameUpdate(curFrame);
			_buffSystem?.OnLogicFrameUpdate();
		}

		public override void OnDie()
		{
			base.OnDie();
			_buffSystem?.OnDispose();
			_buffSystem = null;
			actorState = null;
		}

		public virtual void OnBeHit(DamageInfo damageInfo)
		{
			Debug.Log($"Player Be Hit DamageValue:{damageInfo.damage.damageValue}");
		}
	}
}